package org.lex.ftp.ui.actions;

import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;

import org.lex.ftp.FTP;
import org.lex.ftp.ui.explorer.FTPExplorer;
import org.lex.ftp.ui.find.FTPFileFindDialog;

public class FindAction extends FTPAction {
	public FindAction(FTP app) {
		super(app);
		this.setName("Find...");
		this.setAcceleratorKey(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0));
		;
	}

	public void actionPerformed(ActionEvent e) {
		FTPExplorer pane = app.getFTPExplorer();
		Window main = app.getRootWindow();
		if (false == pane.isConnected()) {
			JOptionPane.showMessageDialog(main, "������δ����", "Error", JOptionPane.ERROR_MESSAGE);
			return;
		}
		FTPFileFindDialog find = new FTPFileFindDialog(app, pane.getFTPModel().getCatalog());
		find.setLocationRelativeTo(main);
		find.setVisible(true);
	}
}
